﻿@model WebUI.Models.QizSubject
<table class="width noborder toolbox">
    <tr>
        <td width="220" nowrap="nowrap" align="left">
            <div class="catalog-title">
                @Model.Title
            </div>
        </td>
        <td align="left">
            <div class="icons icons-add">
                @if (!Model.IsSF36Subject)
                {
                    @Ajax.ActionLink("导入指标", "SftMingXiAdd", new { ID = Model.ID, utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('随访单明细');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                }
            </div>
        </td>
        <td align="right">
            @using (Ajax.BeginForm("SortSftMingXiVal", new AjaxOptions()
            {
                LoadingElementId = "OnLoadingSpan",
                UpdateTargetId = "listview",
                InsertionMode = InsertionMode.Replace,
                HttpMethod = "Post",
                //OnSuccess = "$('#dialogbox').dialog('close');",
                OnFailure = "OnSiteError"
            }))
            {
                <div class="tiny-input">
                    <input name="ID" type="hidden" value="@Model.ID" />
                    快速排序：从
                    <input name="srcidx" type="text" />到
                    <input name="desidx" type="text" /><input class="ui-button ui-widget ui-state-default ui-corner-all"
                        type="submit" value="确定" />
                </div>
            }
        </td>
    </tr>
</table>
<table class="width withhilighter">
    <tr>
        <th>
            顺序
        </th>
        <th>
            随访项名称
        </th>
        <th>
            随访项简短名称
        </th>
        <th>
            指标数据类型
        </th>
        <th>
            关联关系
        </th>
        <th>
            上手机站
        </th>
        <th>
        </th>
    </tr>
    @{int dColor = 0;
      
    }
    @foreach (var item in Model.QizSubjectDefines.OrderBy(v => v.SortIdx))
    {
        try
        {
            if (item.QizItem.Type == "207")
            {
        <tr class="tr-backColor@(dColor++ % 2)" style="font-weight: bold;">
            <td>@Html.DisplayFor(model => item.SortIdx)
            </td>
            <td>
                @(string.IsNullOrEmpty(item.ParentSubjDefID) ? "" : "…")
                @Html.DisplayFor(model => item.QizItem.Title)
            </td>
            <td>
                @Html.DisplayFor(m => item.QizItem.TypeRef.OptionTitle)
                @if (item.QizItem.TypeRef.OptionValue == "4" || item.QizItem.TypeRef.OptionValue == "5")
                {
                    <text>:</text>@Html.DisplayFor(model => item.QizItem.EnumDefine.EnumName)
                }
            </td>
            <td>
                @(string.IsNullOrEmpty(item.ParentSubjDefID) ? "" : Html.FixStrMiddle(item.ParentSubjDef.QizItem.Title, 7) + ":" + item.ParentSubjDef.QizItem.EnumDefine.EnumValues.Where(v => v.EnumValID == item.ParentSubjDefVals).FirstOrDefault().OptionTitle)
            </td>
            <td>
                @(string.IsNullOrEmpty(item.ParentSubjDefID) ? "" : Html.FixStrMiddle(item.ParentSubjDef.QizItem.Title, 7) + ":" + item.ParentSubjDef.QizItem.EnumDefine.EnumValues.Where(v => v.EnumValID == item.ParentSubjDefVals).FirstOrDefault().OptionTitle)
            </td>
            <td>@(item.IsAllowInMobile ? "是" : "")
            </td>
            <td width="160px">
                @if (!Model.IsSF36Subject)
                {
                    <text>
                    @Ajax.ActionLink("上移", "SortSftMingXi", new { ID = item.ID, Sort = "U", utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                    @Ajax.ActionLink("下移", "SortSftMingXi", new { ID = item.ID, Sort = "D", utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                    &nbsp;|&nbsp;@Ajax.ActionLink("删除", "DelSftMingXi", new { ID = item.ID, utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError", Confirm = OnConfirmDel() })
                    &nbsp;|&nbsp; @Ajax.ActionLink("高级", "SftMingXiEdit", new { ID = item.ID, utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('高级设置');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                    </text>
                }
            </td>
        </tr>
            }
            else
            {      
        <tr class="tr-backColor@(dColor++ % 2)">
            <td>@Html.DisplayFor(model => item.SortIdx)
            </td>
            <td>
                @(string.IsNullOrEmpty(item.ParentSubjDefID) ? "" : "…")
                @Html.DisplayFor(model => item.QizItem.Title)
            </td>
            <td>
                @Html.DisplayFor(model => item.ShortTitle)
            </td>
            <td>
                @Html.DisplayFor(m => item.QizItem.TypeRef.OptionTitle)
                @if (item.QizItem.TypeRef.OptionValue == "4" || item.QizItem.TypeRef.OptionValue == "5")
                {
                    <text>:</text>@Html.DisplayFor(model => item.QizItem.EnumDefine.EnumName)
                }
            </td>
            <td>
                @(string.IsNullOrEmpty(item.ParentSubjDefID) ? "" : Html.FixStrMiddle(item.ParentSubjDef.QizItem.Title, 7) + ":" + item.ParentSubjDef.QizItem.EnumDefine.EnumValues.Where(v => v.EnumValID == item.ParentSubjDefVals).FirstOrDefault().OptionTitle)
            </td>
            <td>@(item.IsAllowInMobile ? "是" : "")
            </td>
            <td width="160px">
                @if (!Model.IsSF36Subject)
                {
                    <text>@*
                    <ul class="CtxMenu">
                        <li>
                            @Ajax.ActionLink("上移", "SortSftMingXi", new { ID = item.ID, Sort = "U", utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                        </li>
                        <li>
                            @Ajax.ActionLink("下移", "SortSftMingXi", new { ID = item.ID, Sort = "D", utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                        </li>
                        <li>
                            @Ajax.ActionLink("高级", "SftMingXiEdit", new { ID = item.ID, utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('高级设置');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                            <ul>
                                <li>
                                    @Ajax.ActionLink("关联", "SftMingXiRelation", new { ID = item.ID, utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('关联到');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                                </li>
                                <li>@Ajax.ActionLink("诊断", "SftMingXiZhenDuan", new { ID = item.ID, utid = "" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('诊断');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                                </li>
                                <li>
                                    @Ajax.ActionLink("删除", "DelSftMingXi", new { ID = item.ID, utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError", Confirm = OnConfirmDel() })
                                </li>
                            </ul>
                        </li>
                    </ul>
*@
                    @Ajax.ActionLink("上移", "SortSftMingXi", new { ID = item.ID, Sort = "U", utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                    @Ajax.ActionLink("下移", "SortSftMingXi", new { ID = item.ID, Sort = "D", utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                    &nbsp;|&nbsp; @Ajax.ActionLink("删除", "DelSftMingXi", new { ID = item.ID, utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError", Confirm = OnConfirmDel() })
                    &nbsp;|&nbsp; @Ajax.ActionLink("高级", "SftMingXiEdit", new { ID = item.ID, utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('高级设置');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                    </text>
                }
            </td>
        </tr>
            }
        }
        catch (Exception ex)
        { 
        <tr style="font-weight: bold;" class="error">
            <td>@Html.DisplayFor(model => item.SortIdx)
            </td>
            <td>
                ERROR @ex.Message
            </td>
            <td>
                ID is @item.ID,ItemID is @item.QizItemID, PID is @item.ParentSubjDefID
            </td>
            <td>
                ERROR
            </td>
            <td width="160px">
                @if (!Model.IsSF36Subject)
                {
                    <text>
                    @Ajax.ActionLink("上移", "SortSftMingXi", new { ID = item.ID, Sort = "U", utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                    @Ajax.ActionLink("下移", "SortSftMingXi", new { ID = item.ID, Sort = "D", utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                    &nbsp;|&nbsp;@Ajax.ActionLink("删除", "DelSftMingXi", new { ID = item.ID, utid = "listview" }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "listview", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError", Confirm = OnConfirmDel() })
                    </text>
                }
            </td>
        </tr>

        
        }

    }
</table>
@Html.Partial("TrHilighter", new ViewDataDictionary { { "hitabselector", ".withhilighter" } })
<style type="text/css">
    .ui-menu
    {
        border: 0px solid none;
    }
    .ui-menu .ui-menu
    {
        border: 1px solid gray;
    }
    .ui-menu .ui-menu-item
    {
        display: inline;
        clear: none;
        float: none;
    }
    .ui-menu-item a
    {
        display: inline;
    }
    .ui-menu-item .ui-menu-item a
    {
        display: block;
    }
</style>
<script type="text/javascript">
    //    $(function () {
    //        $(".CtxMenu").menu();
    //    });
</script>
